/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sequence.ui.window;

import sequence.model.Sequence;
import sequence.ui.component.sequence.SequenceContainer;
import sequence.ui.utilities.ComponentLocation;

/**
 * The Class InfoWindow.
 *
 * @author arnaud
 */
public class InfoWindow extends javax.swing.JDialog {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/**
	 * Creates new form InfoWindow2.
	 */
	public InfoWindow() {
		setModalityType(DEFAULT_MODALITY_TYPE);
		initComponents();
	}

	/**
	 * Instantiates a new info window.
	 *
	 * @param parent the parent
	 */
	public InfoWindow(final MainWindow parent) {
		this();
		ComponentLocation.setLocation(parent, this);
		for (final SequenceContainer current : parent.getSequenceContainers()) {
			final Sequence sequence = (Sequence) current.getView().getModel();
			jTabbedPane1.addTab(sequence.getWorkflowID(),
					new InfoSequencePanel(sequence));
		}
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	private void initComponents() {

		jTabbedPane1 = new javax.swing.JTabbedPane();
		jButton1 = new javax.swing.JButton();

		setTitle("Sequences information");
		setPreferredSize(new java.awt.Dimension(600, 800));

		jButton1.setText("OK");
		jButton1.addActionListener(new java.awt.event.ActionListener() {
			@Override
			public void actionPerformed(final java.awt.event.ActionEvent evt) {
				jButton1ActionPerformed(evt);
			}
		});

		final javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addComponent(jTabbedPane1)
				.addGroup(
						javax.swing.GroupLayout.Alignment.TRAILING,
						layout.createSequentialGroup()
								.addContainerGap(462, Short.MAX_VALUE)
								.addComponent(jButton1).addContainerGap()));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addComponent(jTabbedPane1,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										342, Short.MAX_VALUE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jButton1).addContainerGap()));

		pack();
	}// </editor-fold>//GEN-END:initComponents

	/**
	 * J button1 action performed.
	 *
	 * @param evt the evt
	 */
	private void jButton1ActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButton1ActionPerformed
		setVisible(false);
	}// GEN-LAST:event_jButton1ActionPerformed

	/**
	 * The main method.
	 *
	 * @param args the command line arguments
	 */
	public static void main(final String args[]) {
		/*
		 * Set the Nimbus look and feel
		 */
		// <editor-fold defaultstate="collapsed"
		// desc=" Look and feel setting code (optional) ">
		/*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the
		 * default look and feel. For details see
		 * http://download.oracle.com/javase
		 * /tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for (final javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
					.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (final ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(InfoWindow.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (final InstantiationException ex) {
			java.util.logging.Logger.getLogger(InfoWindow.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (final IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(InfoWindow.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (final javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(InfoWindow.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		}
		// </editor-fold>

		/*
		 * Create and display the form
		 */
		java.awt.EventQueue.invokeLater(new Runnable() {

			@Override
			public void run() {
				new InfoWindow().setVisible(true);
			}
		});
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	/** The j button1. */
	private javax.swing.JButton jButton1;
	
	/** The j tabbed pane1. */
	private javax.swing.JTabbedPane jTabbedPane1;
	// End of variables declaration//GEN-END:variables
}
